package com.gee.spring.boot.influxdb.core.query.segment;

import com.gee.spring.boot.influxdb.core.enums.AscDesc;
import com.gee.spring.boot.influxdb.core.query.domain.ColumnInfo;

import static com.gee.spring.boot.influxdb.core.constant.StrConstant.SPACE;

/**
 * @author gepengjun
 * @since 2024/4/28 17:50
 */
public class OrderBySegment implements ISqlSegment {

    private final ColumnInfo columnInfo;

    private final AscDesc ascDesc;

    public OrderBySegment(ColumnInfo columnInfo, AscDesc ascDesc) {
        this.columnInfo = columnInfo;
        this.ascDesc = ascDesc;
    }

    @Override
    public String getSqlSegment() {
        return columnInfo.getColumn().name() + SPACE + ascDesc.getKeyword();
    }
}
